{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Introduction to Quantitative Finance\n",
    "\n",
    "Copyright (c) 2019 Python Charmers Pty Ltd, Australia, <https://pythoncharmers.com>. All rights reserved.\n",
    "\n",
    "<img src=\"img/python_charmers_logo.png\" width=\"300\" alt=\"Python Charmers Logo\">\n",
    "\n",
    "Published under the Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) license. See `LICENSE.md` for details.\n",
    "\n",
    "Sponsored by Tibra Global Services, <https://tibra.com>\n",
    "\n",
    "<img src=\"img/tibra_logo.png\" width=\"300\" alt=\"Tibra Logo\">\n",
    "\n",
    "\n",
    "## Module 1.2: Covariance and Correlation\n",
    "\n",
    "### 1.2.1 Covariance\n",
    "\n",
    "The Covariance is a measure of how much two variables \"move together\". A positive covariance between two variables, say $X$ and $Y$, indicates that when $X$ increases, $Y$ increases. Further, if $X$ decreases, $Y$ decreases also. A *negative* covariance indicates that if $X$ increases, $Y$ decreases, and vice versa.\n",
    "\n",
    "More technically, rather than say \"decreases\", the concept is more formally described as \"with positive covariance, if $X$ is greater than its mean, then $Y$ will likely be greater than its mean also\".\n",
    "\n",
    "To investigate this further, let's take a quick detour through the concept of an **Expected value**."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%run setup.ipy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Expected Value\n",
    "\n",
    "The expected value of a variable, say $X$, is the centre point for its data, and is usually the **mean** of the data."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = [2, 3, 2, 1, 3, 5, 1, 1, 3, 1, 4, 5, 5, 2, 5, 6, 3, 5, 3, 6]  # Dice rolls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "sample_expected_value = float(sum(X)) / float(len(X))  # Alternatively, np.mean(X)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3.3"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sample_expected_value"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "It is important to note that in the above, we computed the *sample mean*, which is an approximation of the population mean. In \"Expected value\" terms, we have the *true expected value*, indicated by $E[X]$ and alternatively the sample mean, usually indicated by $\\bar{X}$. We won't be dwelling too much on this differentiation at the moment, but will return to the concept in a later module.\n",
    "\n",
    "The [Law of large numbers](https://en.wikipedia.org/wiki/Law_of_large_numbers) states that if you perform an experiment a large number of times, the average of the results of those experiments will approximate the expected value. Further, and with more experiments, the average of results will tend to be closer to the true expected value. In our example above, if we roll the dice *many* more times, our expected value will approximate the true value (of 3.5).\n",
    "\n",
    "\n",
    "In `statsmodels`, we can use a Description object to compute the mean. This provides more statistics than we need at the moment, but we will use the other features later on. NumPy also has a `np.mean` function if you need just that one value."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import statsmodels.api as sm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "d = sm.stats.DescrStatsW(X)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3.3"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d.mean"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Another way to consider this is as a series of probabilities against the value. Our expected frequency for each value in this sample is simply the number of times we have seen each:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[(1, 4), (2, 3), (3, 5), (4, 1), (5, 5), (6, 2)]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from collections import Counter\n",
    "counts = Counter(X)\n",
    "sorted(counts.items()) # First value in each pair is the dice roll, the second is how many times we saw it"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Dividing the frequency through by the total, we obtain the estimated probability of each dice roll value:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 0.2\n",
      "2 0.15\n",
      "3 0.25\n",
      "4 0.05\n",
      "5 0.25\n",
      "6 0.1\n"
     ]
    }
   ],
   "source": [
    "for value in range(1, 7):  # Note: doesn't include endpoint (7)\n",
    "    p = float(counts[value]) / len(X)\n",
    "    print(value, p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Multiplying each of these by the dice roll, we get the expected value again:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "current_sum = 0\n",
    "\n",
    "for value in range(1, 7):  # Note: doesn't include endpoint (7)\n",
    "    p = float(counts[value]) / len(X)\n",
    "    current_sum += (p * value)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3.3000000000000003"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "current_sum"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "As noted above, this value is an estimation of the true expected value (and it is wrong by 0.2 from the true value). If we know the underlying distribution, we can compute the true expected value using the underlying distribution. In this case, we know each possible dice roll has a likelihood of $\\frac{1}{6}$ of appearing, therefore we can compute the expected value:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "expected_value = 0\n",
    "\n",
    "for value in range(1, 7):\n",
    "    expected_value += float(value) * (1/6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3.5"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expected_value"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note that, as in the above, the expected value does not have to be a possible outcome."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For a continuous value, the expected value is:\n",
    "\n",
    "$E[X] = \\int_{-\\infty}^\\infty x f(x) dx$\n",
    "\n",
    "where $f(x)$ is the probability density function of the random variable. Often this is much harder to compute. If the data comes from a known distribution, the equation for computing the expected value may have already been worked out. If not, another option is to just use the sample expected value for a very large sample, but do note that this is an approximation."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Exercise\n",
    "\n",
    "A continuous uniform distribution has a minimum value ($a$) and a maximum value ($b$), and has an equal chance of any value between $a$ and $b$ occurring.\n",
    "\n",
    "1. Create a plot showing a continuous uniform distribution. We covered this distribution in Module 1.1.2.\n",
    "1. What is the Expected value for a continuous uniform distribution? Think about this intuitively first, and then solve more formally using the above equation for computing the expected value."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "E[x] = (a + b) / 2\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjUAAAGdCAYAAADqsoKGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy88F64QAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAl/0lEQVR4nO3df1DU94H/8dcCAtq4kEhhRVH8VWkVoUVdodexVSpY2krPSdHL+Ks0aTy1euRs1DOSXO6G2tSebfSidpqo0/NHnWnInHVwCIpJI4YK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AAAAIxA1AADACEQNAAAwAlEDAACMQNQAAAAjEDUAAMAIRA0AADACUQMAAIxA1AAAACMQNQAAwAhEDQAAMAJRAwAAjEDUAAAAIxA1AADACEQNAAAwAlEDAACMQNQAAAAjEDUAAMAIRA0AADACUQMAAIxA1AAAACMQNQAAwAhEDQAAMAJRAwAAjEDUAAAAIxA1AADACEQNAAAwAlEDAACMQNQAAAAjRPT1BO4Wy7IkSV6vt49nAgAAeur28/bt5/GufGai5vr165KkpKSkPp4JAACw6/r164qJielyjMPqSfoYwOfz6fLlyxo8eLAcDsenem6v16ukpCS9/fbbcjqdn+q5+wPWF/pMX6Pp65PMXyPrC313ao2WZen69etKTExUWFjX75r5zLxSExYWpuHDh9/R+3A6ncZ+s0qszwSmr9H09Unmr5H1hb47scbuXqG5jTcKAwAAIxA1AADACETNpyAqKkrFxcWKiorq66ncEawv9Jm+RtPXJ5m/RtYX+vrDGj8zbxQGAABm45UaAABgBKIGAAAYgagBAABGIGoAAIARiJoe2rp1q5KTkxUdHS23263q6uouxx84cEApKSmKjo5WamqqDh06dJdmak9JSYmmTJmiwYMHKz4+Xvn5+Tp79myXx+zcuVMOhyNgi46Ovksztu/xxx/vMN+UlJQujwmV6ydJycnJHdbncDi0bNmyoOP7+/V76aWX9J3vfEeJiYlyOBwqLS0NuN2yLG3YsEFDhw7VwIEDlZ2drTfffLPb89p9DN9JXa3x1q1bevTRR5WamqrPfe5zSkxM1MKFC3X58uUuz9mb7/M7pbtruHjx4g5zzc3N7fa8oXINJQV9TDocDj311FOdnrO/XMOePC+8//77WrZsmYYMGaJ77rlHc+fOVWNjY5fn7e1j1w6ipgf279+voqIiFRcXq7a2VmlpacrJyVFTU1PQ8cePH9f8+fNVWFiouro65efnKz8/X6dPn77LM+/esWPHtGzZMp04cULl5eW6deuWZs2apdbW1i6Pczqdamho8G8XLly4SzPunQkTJgTM949//GOnY0Pp+knSn/70p4C1lZeXS5Luv//+To/pz9evtbVVaWlp2rp1a9Dbf/azn+lXv/q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VVWefPn7defPFF6ytf+Yo1btw46/333+90faF0DW9raWmxBg0aZD3zzDNBz9Ffr2FPnhcefvhha8SIEdaRI0eskydPWpmZmVZmZmbAecaPH2/9/ve/93/dk8fuJ0XU9NDTTz9tjRgxwoqMjLSmTp1qnThxwn/b9OnTrUWLFgWM/93vfmd94QtfsCIjI60JEyZYf/jDH+7yjHtGUtDtueee84/5+PpWrVrl/7tISEiwvvWtb1m1tbV3f/I9VFBQYA0dOtSKjIy0hg0bZhUUFFjnzp3z3x7K1++2w4cPW5Kss2fPdrgt1K7f0aNHg35P3l6Dz+ezHnvsMSshIcGKioqyZs6c2WHdI0eOtIqLiwP2dfUYvtu6WuP58+c7fVwePXrUf46Pr7G77/O7qav1vfvuu9asWbOsz3/+89aAAQOskSNHWg8++GCHOAnla3jb9u3brYEDB1rNzc1Bz9Ffr2FPnhfee+896x//8R+te++91xo0aJD1ve99z2poaOhwnr89pieP3U/K8f/vGAAAIKTxnhoAAGAEogYAABiBqAEAAEYgagAAgBGIGgAAYASiBgAAGIGoAQAARiBqAACAEYgaAABgBKIGAAAYgagBAABGIGoAAIAR/h99xwaRELa8ZgAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# (1)\n",
    "a = 0\n",
    "b = 20\n",
    "x = np.linspace(a,b , 200)\n",
    "y = [1/(b-a)] * 200\n",
    "plt.plot(x, y)\n",
    "\n",
    "# \n",
    "print(\"E[x] = (a + b) / 2\")\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "*For solutions, see `solutions/uniform.py`*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Computing Covariance\n",
    "\n",
    "The Covariance between two variables, $X$ and $Y$, is denoted as $cov(X,Y)$ and can be computed using the Expected Values of $X$ and $Y$.\n",
    "\n",
    "$cov(X,Y) = E[(X-E[X])(Y-E[Y])]$\n",
    "\n",
    "This reduces to the form:\n",
    "\n",
    "$cov(X,Y) = E[XY] - E[X]E[Y]$\n",
    "\n",
    "(To do the reduction, note that $E[E[X]] = E[X]$)\n",
    "\n",
    "In this form, it is easily computable. If you have sample data instead of the real underlying distribution, you can replace $E[X]$ with the value $\\bar{X}$, $E[Y]$ with value $\\bar{Y}$, and $E[XY]$ with the value $\\bar{XY}$. This obtains an estimate for the covariance."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Using the NumPy library, we can compute (an estimate of) the covariance using the `np.cov` function:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x155f87e9090>]"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAiwAAAGdCAYAAAAxCSikAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy88F64QAAAACXBIWXMAAA9hAAAPYQGoP6dpAABEM0lEQVR4nO3dfXxTVZ4/8E9aaQsMDRRs0zIFKmqd8tAiSi2DM4rVFlmGOrsKHRVEwJGFWbU+YOc1UqvuVIRRGGXBYXhyGUHcVViUqQtFYJEC8tB1Kg8D3SICSdEiCa3SQnN+f/SXQNqkyU2Te8+9+bxfr7xe9Obmcm7T5H7vOd/zPSYhhAARERGRxKK0bgARERGRPwxYiIiISHoMWIiIiEh6DFiIiIhIegxYiIiISHoMWIiIiEh6DFiIiIhIegxYiIiISHrXaN2AUHA6nThz5gx69OgBk8mkdXOIiIgoAEIIXLhwASkpKYiK6rgPxRABy5kzZ5Camqp1M4iIiCgIX3/9NX784x93uI8hApYePXoAaD3h+Ph4jVtDREREgXA4HEhNTXVfxztiiIDFNQwUHx/PgIWIiEhnAknnYNItERERSY8BCxEREUmP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XQ/IiIio2LAoqERaQlINsfB1+RlE1pnC41IS1CzWURERNJhwKKh6CgTSsZlAEC7oMX1c8m4DNZjISKiiMeARWP5g5Ox+KGbYTF7DvtYzHFY/NDNrMNCREQEFo6TQv7gZNydYWGlWyIiIh8YsEgiOsqEnIG9tW4GERGRlDgkRERERNJjwEJERETSY8BCRERE0mPAQkRERNILKmBZtGgRBgwYgLi4OGRnZ2Pv3r0+9126dCluv/129OrVC7169UJubm67/R955BGYTCaPR35+fjBNIyIiIgNSHLC89957KCoqQklJCQ4cOIDMzEzk5eXh7NmzXvfftm0bCgsL8emnn6KyshKpqam45557cPr0aY/98vPzYbVa3Y81a9YEd0ZERERkOCYhhFDyguzsbNx666146623AABOpxOpqan4zW9+g+eff97v61taWtCrVy+89dZbmDRpEoDWHpbz589j/fr1ys8AgMPhgNlsht1uR3x8fFDHICIiInUpuX4r6mFpbm7G/v37kZube+UAUVHIzc1FZWVlQMf4/vvvcenSJSQkeK6Ps23bNiQmJiI9PR0zZsxAfX29z2M0NTXB4XB4PIiIiMi4FAUs3377LVpaWpCUlOSxPSkpCTabLaBjzJ49GykpKR5BT35+Pt555x1UVFRg7ty52L59O8aMGYOWlhavxygrK4PZbHY/UlNTlZwGERER6YyqlW5fffVVrF27Ftu2bUNc3JW1cyZOnOj+95AhQzB06FAMHDgQ27Ztw1133dXuOMXFxSgqKnL/7HA4pApaWpyCZfaJiIhCSFHA0qdPH0RHR6Ours5je11dHSwWS4evnT9/Pl599VVs2bIFQ4cO7XDf6667Dn369MHx48e9BiyxsbGIjY1V0nTVlFdbUbrxEKz2i+5tyeY4lIzL4EKGREREQVI0JBQTE4Phw4ejoqLCvc3pdKKiogI5OTk+X/faa6/h5ZdfRnl5OW655Ra//8+pU6dQX1+P5GR9XeDLq62YsfqAR7ACADb7RcxYfQDl1VaNWkZERKRviqc1FxUVYenSpVi1ahUOHz6MGTNmoLGxEVOmTAEATJo0CcXFxe79586dixdeeAHLly/HgAEDYLPZYLPZ0NDQAABo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88+79P/vsM3HNNdeI+fPni8OHD4uSkhLRpUsX8be//U2rU+jQjBkzhNlsFtu2bfN4r77//nv3Pm3PsbS0VHzyySeipqZG7N+/X0ycOFHExcWJL7/8UotT6NDTTz8ttm3bJmpra8Vnn30mcnNzRZ8+fcTZs2eFEPp//1xaWlpEv379xOzZs9s9p7f378KFC+5rHQDx+uuvi4MHD4qvvvpKCCHEq6++Knr27Ck2bNggvvjiCzF+/HiRlpYmfvjhB/cxRo8eLd588033z/4+x6EQ8QHL5MmTBYB2j08//dS9z4kTJ8SYMWNE165dRZ8+fcTTTz/tEWF/+umnAoCora11b6uvrxeFhYXiRz/6kYiPjxdTpkxxB0EyKCwsFCNHjvT6XG1trcfv4OTJk+JnP/uZSEhIELGxseL6668Xzz77rLDb7Sq2ODD79+8X2dnZwmw2i7i4OPGTn/xE/P73v/foDWt7fkII8cMPP4h//ud/Fr169RLdunUT9913n0cAIJMVK1Z4/Zu9usNUb+/hm2++Kfr16ydiYmLEiBEjxO7du93P/fznPxeTJ0/22H/dunXixhtvFDExMWLQoEHi448/VrnFgfP1Xq1YscK9T9tzfPLJJ92/j6SkJHHvvfeKAwcOqN/4AEyYMEEkJyeLmJgY0bdvXzFhwgRx/Phx9/N6f/9cPvnkEwFAHD16tN1zenv/XNestg/XOTidTvHCCy+IpKQkERsbK+666652592/f39RUlLisa2jz3EomIQQInQDTEREREShxzosREREJD0GLERERCQ9BixEREQkPQYsREREJD0GLERERCQ9BixEREQkPQYsREREJD0GLERERCQ9BixEREQkPQYsREREJD0GLERERCQ9BixEREQkvf8Hzbn9KAJoZCQAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "X = np.linspace(-10, 10, 100)\n",
    "Y = np.random.random(100) + np.linspace(0, 1, 100)\n",
    "plt.plot(X, Y, 'o')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[34.35023637,  1.57903687],\n",
       "       [ 1.57903687,  0.15457948]])"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "C = np.cov(X, Y)\n",
    "C"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Wait, that's not one value! That is a covariance matrix, which includes the variance values on the diagonal. In this case, `C[0][0]` is the same as `np.var(X)`, because $cov(X, X) = var(X)$ (and similarly for $Y$):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(34.00673400673401, 0.15303368026857941)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.var(X), np.var(Y)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Further, we can see from the results that $cov(X,Y) = cov(Y, X)$. You can confirm this by swapping $X$ and $Y$ in the covariance equation above."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Exercise\n",
    "\n",
    "1. Create two sets of numbers that have a *negative correlation*\n",
    "2. Create two sets of numbers that have approximately a *zero correlation*"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-1.0\n",
      "-0.05307460221383235\n"
     ]
    }
   ],
   "source": [
    "# (1)\n",
    "x = np.random.random(100)\n",
    "y = 1 - x\n",
    "correlation, p_value = stats.pearsonr(x, y)\n",
    "print(correlation)\n",
    "\n",
    "# (2)\n",
    "x = np.random.random(100) #+ np.linspace(0, 1, 100)\n",
    "y = np.random.random(100)\n",
    "\n",
    "correlation, p_value = stats.pearsonr(x, y)\n",
    "print(correlation)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "*For solutions, see `solutions/correlations.py`*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Dimensionality Analysis\n",
    "\n",
    "In data, numbers are rarely in isolation - they normally have units associated with them. For instance, here are a bunch of heights and weights of 30 people:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "heights = np.array([178.64530591, 173.06618977, 155.22558268, 186.8983648 ,\n",
    "       149.16650972, 164.3049925 , 156.8397536 , 166.07190208,\n",
    "       174.11183283, 155.54411733, 152.61490567, 182.89611452,\n",
    "       145.79498225, 169.50606044, 157.94949789, 170.43628341,\n",
    "       175.95694371, 178.09153374, 178.51960883, 173.56347301,\n",
    "       158.79606688, 168.593175  , 159.88907252, 174.0085056 ,\n",
    "       172.05981633, 175.79140631, 165.6368616 , 191.2270476 ,\n",
    "       179.92045118, 153.1153195 ])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "weights = np.array([ 88.39616195,  63.77670541,  82.1551606 , 102.81391498,\n",
    "        54.11862754,  73.19813772,  87.89767135,  77.42374335,\n",
    "        68.65163289,  81.00977302,  76.8384397 , 119.6155542 ,\n",
    "        92.78823634,  73.24696289,  72.12448243,  87.41055872,\n",
    "        88.22139197, 102.50923756,  83.48268745,  82.69144239,\n",
    "        72.76970268,  96.6186149 ,  81.97160878,  85.20213248,\n",
    "        95.62580765,  91.80510994,  67.09249674,  86.42500849,\n",
    "        83.76262709,  71.82791366])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The covariance of these is strong (taller people tend to weigh more):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "73.26405232380192"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.cov(heights, weights)[0][1]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "That's a positive value, and we could compare this against a similar covariance, *only if the units match*. That is, our heights are in centimetres, and our weights are in kilograms, so our covariance has a **unit of cmkg**. We can only compare other covariances with the same unit.\n",
    "\n",
    "Further, the unit cmkg has little meaning to most people and therefore the actual value of the covariance is hard to reason about. For contrast, take the standard deviation of the heights:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "11.384729794575746"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.std(heights)  # Remembering that np.var(heights) will be in cm squared!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can intuitively get an idea that lots of people will have heights \"about 11cm from the mean\", and one can easily picture that a good portion of the population lie within this 11cm radius around the mean, i.e. the boundary:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(156.75665944575758, 179.52611903490907)"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(np.mean(heights) - np.std(heights)), (np.mean(heights) + np.std(heights))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "However, we can not get a similar intuitive grasp on what it means to have a covariance of 73.2 cmkg, and it might actually be misleading to try and relate that to other known concepts.\n",
    "\n",
    "It is for this reason that we usually use the correlation, which addresses this dimensionality problem. We will investigate the correlation in the next module."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
